package Studing;

/**
 * @ClassName TestToString
 * @Description: TODO
 * @Author hl
 * @Date 2020/8/12
 * @Version V1.0
 **/
public class TestClone {
    public static void main(String[] args) {
        Orignle o1=new Orignle();
        Orignle o2=null;
        try {
            o2=o1.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        o1.a[2]=110;
        System.out.println(o1.a[2]);
        System.out.println(o2.a[2]);

    }



}
class Orignle implements Cloneable{
    int[] a;


    public Orignle() {
        a=new int[10];
        for(int i=0;i<10;i++){
            a[i]=i;
        }

    }



    @Override
   protected Orignle clone() throws CloneNotSupportedException {
      return (Orignle)super.clone();
  }
}
